package com.yb.nowcoder;
import java.util.*;

public class Main003 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            String s = in.next();
            List<String> list = new LinkedList<>();
            for (int i = 0; i < s.length(); i++) {
                String str = String.valueOf(s.charAt(i));
                if (list.contains(str)) {
                    list.add(str);
                    break;
                } else {
                    list.add(str);
                }
            }
            System.out.println(loop(list));
        }
    }

    private static String loop(List<String> list) {
        if (list.isEmpty()) {
            return "0";
        }
        Map<String, Integer> map = new HashMap<>();
        for (String s : list) {
            if (!map.containsKey(s)) {
                map.put(s, 1);
            } else {
                return s;
            }
        }
        return "0";
    }
}
